/* 
 * phrase pattern definition
 *
 * Choi Jonghwan<saxboy@gmail.com>
 * 2006/04/23
 */

#ifndef __PATTERN_H__
#define __PATTERN_H__

#include "note.h"

#define MAX_PATTERN_NAME_LEN		32
#define MAX_ELEMENTS_PER_PATTERN	12

typedef	struct __pattern_elem {
	int pos;	/* position of note in the chord/scale */ 
	NOTE_LENGTH note_length; 
} _PATTERN_ELEM; 
typedef _PATTERN_ELEM *PATTERN_ELEM; 

typedef struct __phrase_pattern {

	/* FIXME: list here... 
	 * 
	 * vector<pattern_t> ?
	 */

	char name[32]; 

	/* FIXME: use union or something... */

	int elem_count; 
	_PATTERN_ELEM elems[MAX_ELEMENTS_PER_PATTERN]; 

	int pattern_length; 	/* length of pattern in note_length */


	/* drum patterns */
	int b_is_drum_pattern; 
	char drum_pattern[128]; 
	

} _PATTERN; 
typedef _PATTERN *PATTERN; 



PATTERN pattern_New(void); 
PATTERN pattern_NewWithDefinition(const char *def); 
int pattern_Delete(PATTERN p); 
int pattern_ImportDefinition(PATTERN p, const char *def); 
int pattern_AddElement(PATTERN p, PATTERN_ELEM elem); 

int pattern_AddCreativity(PATTERN p); 

#endif /* __PATTERN_H__ */

